package com.tsd.system.dao;

import com.tsd.core.vo.PageBean;
import com.tsd.system.entity.SysResource;
import com.tsd.system.entity.SysResourceExt;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * 描述：SysResourceMapper
 *
 * @author Hillpool
 * @date 2019/03/12 12:20:51
 */
public interface SysResourceMapper {

    SysResource selectByPrimaryKey(Long id);

    SysResourceExt selectBySid(String sid);

    List<SysResourceExt> selectByPage(@Param("params") Map<String, Object> params, @Param("page") PageBean page);

    int deleteByPrimaryKey(Long id);

    int insert(SysResource record);

    int insertSelective(SysResource record);

    int updateByPrimaryKey(SysResource record);

    int updateByPrimaryKeySelective(SysResource record);

    SysResourceExt selectOtherByCodeInSameParent(SysResource record);

    int countByParentSid(@Param("parent_sid") String parentSid);

    List<SysResourceExt> selectByParentSid(@Param("parent_sid") String parentSid);

    void updateParent(SysResource record);

    List<SysResourceExt> select4UserId(String userId);

    List<SysResourceExt> selectValidApplications(String userId);

    List<SysResourceExt> select4RoleSid(String roleSid);

    List<SysResourceExt> select4GroupSidRoleSid(@Param("params") Map<String, Object> params);

    List<SysResourceExt> selectByParentId4GroupSidRoleSid(@Param("params") Map<String, Object> params);

    List<SysResourceExt> selectByParams(@Param("params") Map<String, Object> params);

    List<SysResourceExt> selectByParentCode4UserId(@Param("parentCode") String parentCode, @Param("userId") String userId);

    List<SysResourceExt> selectByParentId4UserIdFromRole(@Param("parentCodeList") List<String> parentCodeList, @Param("userId") String userId);

    void addResourceFromMaster(@Param("db_name") String db_name, @Param("full_code") String full_code);

    void deleteByAccoutSetAndRes(@Param("db_name") String db_name, @Param("full_code") String full_code);

    List<SysResourceExt> selectByParentId4Admin(@Param("parentCodeList") List<String> parentCode);

    void deleteRoleResourceByAccoutSetAndRes(@Param("db_name") String db_name, @Param("full_code") String full_code);

    List<SysResourceExt> select4Shiro(@Param("role_list") List<String> role_list);

    int updateResource4Mode(@Param("mode_list") List<String> mode_list, @Param("dr") Integer dr);

    Integer checkRightByUser(@Param("user_sid") String user_sid, @Param("permission") String permission);
}
